home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4440 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  69 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: cs.vu.nl!irmen
  3. From: irmen@cs.vu.nl (Irmen de Jong)
  4. Subject: Re: Message port
  5. Nntp-Posting-Host: sloep63.cs.vu.nl
  6. References: <708.6632T987T2426@academy.bastad.se>
  7. Sender: news@cs.vu.nl
  8. Organization: Dept. of Computer Science, Vrije Universiteit Amsterdam
  9. Date: Thu, 29 Feb 1996 10:02:29 GMT
  10. X-Newsreader: TIN [version 1.2 PL2]
  11. Message-ID: <DnJ7w6.9M7.0.-s@cs.vu.nl>
  12.  
  13. On 28 Feb 1996 19:39:41 GMT Sten Jansson (sten@academy.bastad.se) (Sten Jansson) wrote:
  14. : I've tried to create a message-port in a simple test-program. It works,
  15. : ,but as soon as I start another program the message-port disappear.
  16. : Here is my program:
  17. : --
  18. : void AddportT(struct MsgPort * MP)
  19.  
  20. If the function must return the freshly created MsgPort, you should use
  21. void AddportT(struct MsgPort **MP)
  22. (mind the double *)
  23. and replace MP in the function by (*MP).
  24.  
  25.  
  26. : {
  27. :  int SIGBIT;
  28.  
  29. :  if((SIGBIT=AllocSignal(-1L))==-1)
  30. :    exit(0);
  31.  
  32. :  MP=  AllocMem(sizeof(struct MsgPort),MEMF_PUBLIC|MEMF_CLEAR);
  33. :  if(!MP)
  34. :  {
  35. :    printf("Kunde inte allockera minne f÷r MsgPort\n");
  36.  
  37.         Sure... ;)
  38.  
  39. :    exit(1);
  40.  
  41.     Don't forget to FreeSignal()!
  42.  
  43. :  }
  44.  
  45. :  MP->mp_Node.ln_Name="WF";
  46. :  MP->mp_Node.ln_Pri=-125;
  47. :  MP->mp_Node.ln_Type=NT_MSGPORT;
  48.  
  49. :  MP->mp_Flags=PA_SIGNAL;
  50. :  MP->mp_SigBit=SIGBIT;
  51.  
  52. :  MP->mp_SigTask=(struct Task*)FindTask(0);
  53.  
  54. :  AddPort(MP);
  55. : }
  56. : --
  57.  
  58. : Please help me if You know what's wrong! Maybe I should use some
  59. : special compiler directives?
  60.  
  61. : /Sten
  62.  
  63.  
  64. You might want to use exec.library/CreateMsgPort and exec.library/DeleteMsgPort.
  65.  
  66. --
  67. / Irmen de Jong (email: irmen@cs.vu.nl WWW: http://www.cs.vu.nl/~irmen/)  \
  68. \                 ``Nothing lasts forever'' -- Species                    /
  69.